package com.daidai.sink;

import org.apache.flink.core.fs.FileSystem;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class BaseSink {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStreamSource<Long> source = env.fromSequence(0, 100).setParallelism(3);

        //print
        source.print();

        //以err的方式输出
        source.printToErr();

        //writeAsText， 当setParallelism>1时，为文件夹， =1时为文件
        source.writeAsText("sinkresult", FileSystem.WriteMode.OVERWRITE).setParallelism(3);

        env.execute();
    }
}
